package com.huiminpay.transaction.api;

import com.huiminpay.common.cache.domain.BusinessException;
import com.huiminpay.transaction.dto.PayChannelDTO;
import com.huiminpay.transaction.dto.PayChannelParamDTO;
import com.huiminpay.transaction.dto.PlatformChannelDTO;

import java.util.List;

/**
 * @Author: yz
 * @Date: 2024/7/23 14:19
 */
public interface PayChannelService {
    /**
     * 查询所有服务类型
     * @return 服务类型集合
     */
    List<PlatformChannelDTO> queryPlatFormChannel() throws BusinessException;

    /**
     * 为应用绑定服务类型
     * @param appid 应用id
     * @param platformChannelCode 服务类型code
     * @throws BusinessException
     */
    void bindPlatformChannelForApp(String appid,String platformChannelCode) throws BusinessException;

    /**
     * 应用是否已经绑定了某个服务类型
     * @param appid 应用id
     * @param platformChannelCode 服务类型code
     * @return 0为绑定 1已绑定
     * @throws BusinessException
     */
    int queryAppBindPlatformChannel(String appid,String platformChannelCode) throws BusinessException;

    /**
     * 根据平台类型回去支付渠道列表
     * @param platformChannelCode 平台类型
     * @return
     * @throws BusinessException
     */
    List<PayChannelDTO> queryPayChannelByPlatformChannel(String platformChannelCode) throws BusinessException;

    /**
     * 配置支付渠道参数
     * @param payChannelParamDTO 支付渠道参数
     * @throws BusinessException
     */
    void createPayChannelParam(PayChannelParamDTO payChannelParamDTO)  throws BusinessException;

    /**
     * 根据应用和服务类型查询支付渠道参数列表
     * @param appId
     * @param platformChannelCode
     * @return
     * @throws BusinessException
     */
    List<PayChannelParamDTO> queryPayChannelParamByAppIdAndPlatformChannelCode(String appId,String platformChannelCode) throws BusinessException;

    /**
     * 根据应用、服务类型及支付渠道获取原始支付参数
     *
     * @param appId
     * @param platformChannelCode
     * @param payChannelCode
     * @return
     * @throws BusinessException
     */
    PayChannelParamDTO queryPayChannelParamByAppIdAndPlatformChannelCodeAndPayChannelCode(String appId,String platformChannelCode,String payChannelCode) throws BusinessException;

}
